package com.lglbc.day03;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author 乐哥聊编程
 * @Doc 关注公众号"乐哥聊编程"获取文档和源码
 * @Date 2023/4/1
 * @Description
 */
@Mapper
public interface UserMapper {
    @Select("select r.* from user_role ur LEFT JOIN role r on ur.rid=r.id where ur.uid=#{id}")
    public List<User.Role> getRolesByUid(@Param("id") Integer id);

    @Select("select * from user where username=#{uname} limit 1")
    public User loadUserByUserName(String uname);
}
